<template>
  <div class="item-container">
    <div>
      <div class="item-text">{{ displayText().up }}订单量</div>
      <div class="item-data">
        {{ totalData.order }}
      </div>
    </div>
    <div>
      <div class="item-text">{{ displayText().up }}支付金额</div>
      <div class="item-data">
        <span style="font-size:20px">￥</span>
        <span>{{ totalData.turnover }}</span>
      </div>
    </div>
    <div>
      <div class="item-text">{{ displayText().up }}访客数</div>
      <div class="item-data">
        {{ totalData.visitor }}
      </div>
    </div>
    <div>
      <div class="item-text">{{ displayText().up }}客单价</div>
      <div class="item-data">
        <span style="font-size:20px">￥</span>
        <span>{{ totalData.average_price }}</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'ManageItem',
  props: {
    activeIndex:{
      type: Number,
      required: true,
      default: 1
    },
    totalData: {
      type: Object,
      default: () => { return {
        // turnover: 0,
        // visitor: 0,
        // order: 0,
        // average_price: 0
      } }
    }    
  },
  methods: {
    displayText(){
      if(this.activeIndex == 1){
        return { up: '今日' }
      } else if (this.activeIndex == 2) {
        return { up: '昨日' }
      } else if (this.activeIndex == 3) {
        return { up: '近7天' }
      } else {
        return { up: '近30天' }
      }
    }
  },
}
</script>

<style lang="css" scoped>
.item-container{
  display: flex;
  margin-top: 10px;
  width: 100%;
}
.item-container>div{
  flex: 1;
  margin: 0 4%;
  height: 100px;
  box-sizing: border-box;
  padding: 0 0px;
  text-align: left;
}
.item-text{
  height: 30px;
  line-height: 30px;
  font-size: 14px;
  /* font-weight: 600; */
}
.item-data{
  height: 60px;
  line-height: 60px;
  font-size: 40px;
  font-weight: 600;
  color: #000;
}
</style>